package com.xiangyi.teachingsystem.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiangyi.teachingsystem.entity.po.GroupUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface GroupUserMapper extends BaseMapper<GroupUser> {
    @Select("SELECT gu.id,ug.id group_id,u1.id user_id,u1.`name`,u1.job_num,u1.sex,u1.head_url,gu.leader_sign\n" +
            "FROM group_user gu\n" +
            "LEFT JOIN `user` u1\n" +
            "ON gu.user_id=u1.id\n" +
            "LEFT JOIN user_group ug\n" +
            "ON gu.group_id=ug.id\n" +
            "WHERE ug.id=#{groupId}")
    List<GroupUser> groupUsersList(Integer groupId);
}
